﻿// Original author contact info: Owen Emlen (owene_1998@yahoo.com)
// Note: other individuals may also have contributed to this code
// Project hosted on CodePlex.com as of 1/10/2009 at http://wpfimageviewer.codeplex.com
using System.ComponentModel;
using System.Drawing;
using System.Windows.Media;
using BrainTechLLC;
using BrainTechLLC.ImageOperatorsNonAForgeDependent;
using ImageAppDataModels;
using BrainTechLLC.WPF;

namespace ImageAppViewModels
{
    /// <summary>
    /// ViewModel for BitmapAndDescription
    /// </summary>
    public class BitmapAndDescriptionViewModel : GenericViewModelBase<BitmapAndDescriptionViewModel, BitmapAndDescription>, INotifyPropertyChanged
    {
        public Bitmap OriginalBitmap
        {
            get { return Item.OriginalBitmap; }
            set
            {
                if (Item.OriginalBitmap != value)
                {
                    Item.OriginalBitmap = value;
                    OnPropertyChanged("ImageSource");
                }
            }
        }

        public ImageSource ImageSource
        {
            get { return (Item == null || Item.Bitmap == null) ? null : Item.CreateImageSourceFromBitmap(null); }
        }

        public BitmapAndDescriptionViewModel(BitmapAndDescription item)
        {
            Item = item;
        }
    }
}